import request from '@/utils/http'
// import { BaseResult } from '@/types/axios'
import { SystemInfo } from '@/config/setting'
import { BaseResult } from '@/types/axios'
import { UserInfo } from '@/types/store'
import avatar from '@imgs/user/avatar.png'

export class UserService {
  // 登录接口
  static login(params: any) {
    console.log(params)
    return request.post<BaseResult>({
      url: 'api/admin/common/login',
      data: params
    })
  }

  // 登录验证码接口
  static captcha() {
    return request.get<BaseResult>({
      url: 'api/admin/common/captcha'
    })
  }
  //退出登录
  static loginout() {
    return request.get<BaseResult>({
      url: 'api/admin/admins/logout'
    })
  }
  //退出登录
  static count() {
    return request.get<BaseResult>({
      url: 'api/admin/common/count'
    })
  }
  // 获取用户信息
  static getUserInfo(): Promise<BaseResult<UserInfo>> {
    return new Promise((resolve) => {
      resolve({
        code: 200,
        message: '获取用户信息成功',
        data: {
          id: 1,
          name: '张三',
          username: 'John Snow',
          avatar: avatar,
          email: 'art.design@gmail.com'
        }
      })
    })
  }
}
